package com.InterestingExercises;

import java.util.Scanner;

public class 三个和尚比大小 {
    public static void main(String[] args) {
        //寺庙里有三个和尚，现在要根据年龄的大小来分配袈裟。岁数最大的和尚可以获得五彩仙衣一件，排第二的和尚可以获得旧棕衣一件，岁数最小的和尚可以获得锦澜袈裟一件。
        System.out.println("请依次输入三个和尚的年龄,以空格隔开:");
        Scanner sc = new Scanner(System.in);
        int one = sc.nextInt(), two = sc.nextInt(), three = sc.nextInt(), max = 0, mid = 0, min = 0;

        //先确定最大值
        max = one > two ? (one > three ? one : three) : (two > three ? two : three);
        //再确定最小值
        min = one < two ? (one < three ? one : three) : (two < three ? two : three);

        //三者总和减去最大值最小值就是中间值,巧妙!sum-max-min=mid
        int sum = one + two + three;
        mid = sum - max - min;

        System.out.println(max + "岁最大,获得五彩仙衣\n" + mid + "岁第二,获得旧棕衣\n" + min + "岁最小,获得锦澜袈裟");

//        请依次输入三个和尚的年龄,以空格隔开:
//        100 129 150
//        150岁最大,获得五彩仙衣
//        129岁第二,获得旧棕衣
//        100岁最小,获得锦澜袈裟
    }
}
